/**
 * 
 */
package com.easidea.tim.dao.inventory;

import org.hibernate.Query;
import org.springside.core.dao.extend.HibernateEntityExtendDao;

import com.easidea.tim.entity.inventory.InventoryItem;

/**
 * @author Harrison
 *
 */
public class InventoryItemDao extends HibernateEntityExtendDao<InventoryItem> {
	
	public int deleteItemByInventoryId(Long inventoryId){
		if(inventoryId != null){
			String deleteHQL = "DELETE FROM com.easidea.tim.entity.inventory.InventoryItem i WHERE i.inventory.id = :invId";
			Query deleteQuery = this.createQuery(deleteHQL);
			deleteQuery.setLong("invId", inventoryId);
	        int dels = deleteQuery.executeUpdate();
	        return dels;
		}
		return 0;
	}

}
